using System;

namespace RBTreesSample
{
    /// <summary>
    /// Demonstrates using a key as a separate object
    /// </summary>
    public class OwnKey : IComparable
    {
        public int? Key { get; set; }

        public OwnKey(int key) 
		{
			Key = key;
		}
		
		public int CompareTo(object key)
		{
		    if(Key > ((OwnKey)key).Key)
				return 1;
		    if(Key < ((OwnKey)key).Key)
		        return -1;
		    return 0;
		}

        public override string ToString()
		{
			return Key.ToString();
		}
    }
}